import jwt
from ..init import ENV


class JwtUtils:
    @staticmethod
    def encode(payload: dict) -> str:
        return jwt.encode(payload, ENV.JWT_KEY, algorithm="HS256")

    @staticmethod
    def decode(token: str) -> dict:
        return jwt.decode(token, ENV.JWT_KEY, algorithms=["HS256"])
